using System;
using System.ComponentModel;
using System.Drawing;
using System.Xml.Serialization;

namespace com.exceptionalsoftware.spacetime.KML
{
	[Serializable()]
    [XmlType(TypeName = "OverlayType")]
    public class Overlay : Feature
	{
        private KMLColor colorField;
        private int drawOrderField;
        private Icon iconField;

        public Overlay()
		{
            this.colorField = new KMLColor("ffffffff");
            this.drawOrderField = 0;
		}

        [XmlElement(ElementName = "drawOrder", DataType = "int")]
        [DefaultValue(0)]
        public int DrawOrder
        {
            get { return this.drawOrderField; }
            set { this.drawOrderField = value; }
        }

        [XmlElement(ElementName = "Icon", Type = typeof(Icon))]
        public Icon Icon
        {
            get { return this.iconField; }
            set { this.iconField = value; }
        }

        [XmlIgnore()]
        public Color Color
        {
            get { return this.colorField.Color; }
            set { this.colorField = new KMLColor(value); }
        }

        [XmlIgnore()]
        public string ColorString
        {
            get { return this.colorField.ToString(); }
            set { this.colorField = new KMLColor(value); }
        }

        [XmlElement(ElementName = "color", DataType = "hexBinary", Type = typeof(byte[]))]
        public byte[] ColorComponents
        {
            get { return this.colorField.ToByteArray(); }
            set { this.colorField = new KMLColor(value); }
        }

    }
}